import * as constants from '../Constants'
import { get, GET_SECORD_APPROVAL_LIST, GET_SECORD_SUBMIT_BY_ID } from '../../service/api'

export interface GetSecordApprovalList {
  type: constants.GetSecordApprovalList
  payload: Promise<any>
}
export interface GetSecordApprovalList_PENDING {
  type: constants.GetSecordApprovalList_PENDING
  payload: Promise<any>
}
export interface GetSecordApprovalList_FULFILLED {
  type: constants.GetSecordApprovalList_FULFILLED
  payload: any
}
export interface GetSecordApprovalList_Type {
  type: constants.GetSecordApprovalList_Type
  payload: number
}

export interface RECORD_SecordApproval {
  type: constants.RECORD_SecordApproval
  payload: Promise<any>
}

export interface RECORD_SecordApproval_FULFILLED {
  type: constants.RECORD_SecordApproval_FULFILLED
  payload: any
}

export type SecordApprovalAction = GetSecordApprovalList | 
  GetSecordApprovalList_FULFILLED | 
  GetSecordApprovalList_PENDING |
  GetSecordApprovalList_Type |
  RECORD_SecordApproval |
  RECORD_SecordApproval_FULFILLED

export function recordType(param: number): GetSecordApprovalList_Type {
  return {
    type: constants.GetSecordApprovalList_Type,
    payload: param
  }
}

export function recoreMakes(params: any): RECORD_SecordApproval {
  return {
    type: constants.RECORD_SecordApproval,
    payload: get(GET_SECORD_SUBMIT_BY_ID, params)
  }
}

export function getSecordApprovalList(param: any): GetSecordApprovalList {
  return {
    type: constants.GetSecordApprovalList,
    payload: get(GET_SECORD_APPROVAL_LIST, param)
  }
}